<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
	  <h1>测试数据库</h1>	
	  <table border="1">
	  	 <tr>
	  	 	<td>ID</td>
	  	 	<td>姓名</td>
	  	 	<td>手机</td>
	  	 </tr>
	  	   
	  <?php
	   $conn= mysql_connect("127.0.0.1","root","");
	   if($conn){
	   	 echo "成功";
		 mysql_select_db("web");
		 mysql_query("set names utf8");
	   }else{
	   	 echo "失败";
	   }
	   $sql="select * from user_t";
	   $result= mysql_query($sql);  // 所有数据
	   //得到查询的行数
	   $n= mysql_num_rows($result);
	   
	   for($i=0;$i<$n;$i++){
	     $data= mysql_fetch_assoc($result); // 一行数据
	     $myid=$data["id"];
		 $myname=$data["username"];
		 $myphone=$data["password"]; 
		 echo "<tr><td>$myid</td>";
		 echo "<td>$myname</td>";
	  	 echo "<td>$myphone</td>"; 	 
	   }
  
	  ?>
		</table>	
	</body>
</html>